package de.baumann.browser.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import de.baumann.browser.OdinGlideModule
import de.baumann.browser.R
import de.baumann.browser.api.net.vo.duobao.DuoBaoOrder
import de.baumann.browser.utils.StringUtil

class DuoBaoJieXiaoOrderAdapter : BaseQuickAdapter<DuoBaoOrder, BaseViewHolder>(R.layout.item_duobao_order) {
    override fun convert(helper: BaseViewHolder, item: DuoBaoOrder) {
        helper.setText(R.id.jiexiaoCode, "${item.phaseNum}期")
        helper.setText(R.id.jiexiaoTime, "开奖时间:${item.announceTime}")
        helper.setText(R.id.jiexiaoUserName, item.userName)
        helper.setText(R.id.jiexiaoOdinAddress, StringUtil.StrReplace(item.address))
        helper.setText(R.id.huoJiangCode, "幸运号码:${item.winNum}")
        helper.setText(R.id.canyuFene, "本期参与份额 ${item.participationNum} 份")

        val jiexiaoCover: ImageView = helper.getView(R.id.jiexiaoCover)
        OdinGlideModule.load(mContext, item.thumbnail, jiexiaoCover, R.drawable.shape_cover)

        val zhongJiangBiaoJi: ImageView = helper.getView(R.id.zhongJiangBiaoJi)
        if (item.winFlag == "noWin") {
            zhongJiangBiaoJi.setImageResource(R.drawable.weizhongjiang)
        } else {
            zhongJiangBiaoJi.setImageResource(R.drawable.zhongjiangle)
        }
    }

}